package manage.operation;

import manage.book.Book;
import manage.book.BookList;

import java.util.Scanner;

public class Add implements IO{

    public void work(BookList bookList){
        System.out.println("添加图书");
        Scanner scan = new Scanner(System.in);

        System.out.println("请输入图书名：");
        String name = scan.nextLine();

        System.out.println("请输入作者姓名：");
        String author = scan.nextLine();

        System.out.println("请输入图书价格：");
        int price = scan.nextInt();
        scan.nextLine();

        System.out.println("请输入图书类型：");
        String type = scan.nextLine();

        Book book = new Book(name, author, price, type);
        int currentSize = bookList.getUsedSize();
        bookList.setBooks(currentSize, book);
        bookList.setUsedSize(currentSize + 1);
        System.out.println("添加成功");
    }
}
